﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework;

namespace chemicall
{
    public class MainMenuLoaded : MenuScreen
    {
        GameManager gM;
        public MainMenuLoaded()
            : base("Menu Principal")
        {
            gM = GameManager.getInstance();
            MenuItem chooseLevelEntry = new MenuItem("Selection des niveaux");
            MenuItem optionsMenuEntry = new MenuItem("Options");
            MenuItem aideMenuEntry = new MenuItem("Aide");
            MenuItem exitMenuEntry = new MenuItem("Quitter");

            chooseLevelEntry.Selected += ChooseLevelSelected;
            optionsMenuEntry.Selected += OptionsMenuEntrySelected;
            aideMenuEntry.Selected += AideMenuEntrySelected;
            exitMenuEntry.Selected += OnCancel;

            MenuEntries.Add(chooseLevelEntry);
            MenuEntries.Add(optionsMenuEntry);
            MenuEntries.Add(aideMenuEntry);
            MenuEntries.Add(exitMenuEntry);
        }

        void ChooseLevelSelected(object sender, System.EventArgs e)
        {
            this.ScreenManager.LastScreen = this;
            ScreenManager.AddScreen(new ChooseLevelMenu(), PlayerIndex.One);
        }

        void OptionsMenuEntrySelected(object sender, System.EventArgs e)
        {
            this.ScreenManager.LastScreen = this;
            ScreenManager.AddScreen(new OptionMenu(), PlayerIndex.One);
        }

        void AideMenuEntrySelected(object sender, System.EventArgs e)
        {
            //TODO 
        }

        protected override void OnCancel(PlayerIndex playerIndex)
        {
            ScreenManager.Game.Exit();
        }
    }
}
